package com.crois.barrier.admin.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.crois.barrier.admin.entity.ApiParameterInfo;
import com.crois.barrier.admin.mapper.ApiParameterInfoMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * barrier api参数信息
 * @author Hou Ze Yu
 * @date 2021-10-25 11:58:21
 */
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class ApiParameterInfoSvc extends ServiceImpl<ApiParameterInfoMapper,ApiParameterInfo> implements IApiParameterInfoSvc {

    @Override
    public List<ApiParameterInfo> findApiParameterListByRouteIdAndType(Integer type, Integer apiRouteId) {
        QueryWrapper<ApiParameterInfo> apiParameterInfoQueryWrapper = new QueryWrapper<>();
        apiParameterInfoQueryWrapper.lambda().eq(ApiParameterInfo::getPositionType,type)
        .eq(ApiParameterInfo::getApiRouteId,apiRouteId);
        return baseMapper.selectList(apiParameterInfoQueryWrapper);
    }
}
